home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************
- * *
- * SktSocketManager.h *
- * Copyright 1992 by Nik A Gervae *
- * *
- * One of a set of three Objective-C classes (SktSocketManager, SktSocket, *
- * and SktSocketUser) which implement a convenient interface to Berkeley *
- * stream sockets under NeXTSTEP(r). See the accompanying class *
- * specifications (files with a .rtf or .spec suffix) for further *
- * information. *
- * *
- * NeXTSTEP is a registered trademark of NeXT Computer, Inc. *
- * *
- ****************************************************************************
- * *
- * LICENSE *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation. *
- * *
- * The program and this makefile are distributed in the hope that it will *
- * be useful, but are provided "AS IS" AND WITHOUT ANY WARRANTY; without *
- * any express or implied warranty of MERCHANTABILITY or FITNESS FOR A *
- * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
- * Any use or distribution of the program and documentation must include *
- * appropriate copyrights to acknowledge Nik A. Gervae and the Free *
- * Software Foundation, Inc. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
- * *
- ****************************************************************************
- * *
- * VERSION HISTORY *
- * *
- * Version numbers are simply dates in the form YYYYMMDD. These represent *
- * the date that version was finished. Only significantly changed versions *
- * are reported here, or those versions requiring explanation of changes. *
- * There may be many interim stages between dated versions. *
- * *
- * DateVersion Primary Author Notes *
- * ----------- --------------- -------------------------------------------- *
- * 19920327 Nik A Gervae First released version *
- * 19920723 Nik A Gervae Actually released *
- * *
- ***************************************************************************/
-
- #import <stdio.h>
- #import <stdarg.h>
- #import <sys/time.h>
-
- #ifdef NS3
- #import <objc/zone.h>
- #else
- #import <zone.h>
- #endif
-
- #import <objc/Object.h>
- #import <objc/List.h>
-
- #import "SktSocket.h"
-
- @interface SktSocketManager : Object
- {
- id userClass; // Class of all user instances
-
- FILE *logfile; // diagnostic output
- char *hostaddress; // primary internet address of host in dot notation
- char *hostname; // name of host program is running on
- int servicePort; // internet port of program. Can TELNET to it.
- int numAvailFds; // current amount of available file descriptors
-
- int maxSocketFd; // highest currently open fd--used by select()
- int serviceSocketFd; // fd of the SktSocketManager object: connection
- // requests made here
- List *openSockets; // List object containing all open Socket objects
-
- BOOL doesLog; // YES if non-error messages logged
-
- NXZone *zone; // All SktSockets & users are allocated from here
-
- struct timeval selectTimeout; // how long -update waits to process i/o
- BOOL timeoutIndefinite; // if YES, -update waits indefinitely
- int selectSignalMask; // these are blocked during a select()
- }
-
-
- // Initializing
- - init; // DON'T EVER SEND THIS
- - initPort:(int)portNum logfile:(FILE *)file fdCapacity:(int)cap
- userClass:aClass;
- - setSocketOptions:(int)fd;
- - free;
- - setDoesLog:(BOOL)flag;
- - (BOOL)doesLog;
-
- // "Advanced" Initializing (you need to know about the select() system call)
- - setTimeoutSeconds:(long int)secs microseconds:(long int)usecs;
- - (BOOL)getTimeoutSeconds:(long int *)secs microseconds:(long int *)usecs;
- - setTimeoutIndefinite;
- - (BOOL)isTimeoutIndefinite;
- - (int)setSignalMask:(int)sigmask;
- - (int)signalMask;
-
- // Access
- - setFdCapacity:(int)cap;
- - (int)adjustFdCapacity:(int)byAmount;
- - (int)fdCapacity;
- - (int)numAvailFds;
-
- - (FILE *)logfile;
- - (const char *)hostaddress;
- - (const char *)hostname;
- - (int)servicePort;
- - (char **)getInetAddresses;
-
- // Getting work done
- - update;
-
- // Operations on SktSocket Objects
- - closeSocket:(struct SktSocket *)socketObj;
- - closeAllSockets;
-
- // Utility
- - announceString:(const char *)announcement;
- - log:(const char *)format, ...;
-
- @end /*interface SktSocketManager*/
-